//
//  AppDelegate.m
//  BuDeJie
//
//  Created by TFAppleWork-Summer on 2018/3/19.
//  Copyright © 2018年 TFAppleWork-Summer. All rights reserved.
//

#import "AppDelegate.h"


#import "BDJAdViewController.h"

/*
 优先级：
 LaunchScreen > LaunchImage
 在Xcode中配置了，不起作用： 1 清空缓存 2 直接写在重新安装
 如若是通过LaunchImage设置启动界面，那么屏幕的可视范围由图片决定
 注意：如果使用LaunchImage，需要提供各种尺寸的启动图片
 
 
 LaunchScreen：Xcode 6之后才有的，
 使用方式： 在LaunchScreen.storyboard 中添加一个ImageView
 好处：1 自动识别当前真机/模拟器的尺寸 2 只需提供一个可拉伸的图片  3 可以展示更多的东西
 
 LaunchScreen底层实现：把LaunchScreen截屏生成图片，作为启动图片
 */

/*
 需求每次程序启动的时候都会进入广告页
 方案：
 1 在程序启动的时候去加载广告页面（LaunchScreen）-> ✘，LaunchScreen不支持自定义类
 2 在启动完成的时候去加载广告页面
 2.1 程序已启动的时候进入广告界面，将窗口的跟控制器设置为广告界面
 2.2 直接在窗口上加上一个广告界面，等几秒钟过去了，再将广告界面移除
 */

@interface AppDelegate ()

@end

@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    // 1 创建窗口
    self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds ];
    // 2 设置根控制器
    BDJAdViewController *adVC = [[BDJAdViewController alloc]init];
    // init -> initWithNibName 1,首先判断是否制定了nibName ,2判断是否有更类名相同的Xib
   
    self.window.rootViewController = adVC;
    // 显示窗口
    [self.window makeKeyAndVisible];
    
    return YES;
}


- (void)applicationWillResignActive:(UIApplication *)application {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}


- (void)applicationDidEnterBackground:(UIApplication *)application {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}


- (void)applicationWillEnterForeground:(UIApplication *)application {
    // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}


- (void)applicationDidBecomeActive:(UIApplication *)application {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}


- (void)applicationWillTerminate:(UIApplication *)application {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}


@end
